package com.wzxy.wzinfo.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.wzxy.wzinfo.entiry.User;
import com.wzxy.wzinfo.repository.UserRepository;
import com.wzxy.wzinfo.service.IUserService;

@Service
public class UserService extends MyJpaService<User,Integer> implements IUserService {
	
	private UserRepository userRepository;  
	
	@Autowired
	public void setUserRepository(UserRepository userRepository) {
		this.userRepository = userRepository;
		super.setJpaRepository(userRepository);
		super.setJpaSpecificationExecutor(userRepository);
	}

	@Override
	public User login(User user) {
		return userRepository.findByUsernameAndPassword(user.getUsername(), user.getPassword());
	}
	
}
